<?php

namespace App\Helpers\Formater;
use DateTime;

/**
 * 日期时间转换
 * @author qfh
 */
class DateTimeFormat
{

    /**
     * 计算两个时间的间隔
     * @param $from
     * @param $to
     * @return string
     */
    public static function diffDateTime($from,$to)
    {
        $fromDate   = new DateTime($from);
        $toDate     = new DateTime($to);

        $dateIntval = $fromDate->diff($toDate);
        return $dateIntval->format('相差%r%y年%m月%d天%h小时%i分%s秒');
    }





}
